<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" 
  prefix="c" %>

<c:if test="${ empty errors }">  
	<div class="failed error_box">
		Please check all of the following error messages before continuing
		<ul>
			<c:forEach items="errors" var="err">
				<li>${err}</li>
			</c:forEach>
		</ul>
	</div>
</c:if>

<form action="${currentUrl}" method="post" name="form">
	<div class="config_row">
		<div class="left">Database type
			<span class="form_required">*</span>
		</div>
		<div class="right" id="supported_dbs">
			<c:forEach items="dbs" var="db" varStatus="status">
				<input type="radio" name="db_type" value="${db.current}" id="DB${status.index}" />
				<label for="DB${status.index}">${db.current}</label><br />
			</c:forEach>
		</div>
		<div class="description">
			The type of database your Icy data will be stored in.
			The list has been determined based on your current Java configuration.
		</div>
	</div>

	<div class="config_row">
		<div class="left">Database name
			<span class="form_required">*</span>
		</div>
		<div class="right">
			<input class="text" type="text" value="${dbName}" id="db_name" name="db_name" />
		</div>
		<div class="description">
			The name of the database your Icy data will be stored in. 
			It must exist on your server before Icy can be installed.
		</div>
	</div>
	
	<div class="config_row">
		<div class="left">Database username
			<span class="form_required">*</span>
		</div>
		<div class="right">
			<input class="text" type="text" value="${dbUserName}" id="db_username" name="db_username" />
		</div>
	</div>
	
	<div class="config_row">
		<div class="left">Database password</div>
		<div class="right">
			<input class="text" type="password" value="${dbPassword}" id="db_passwd" name="db_passwd" />
		</div>
	</div>
	
	<div class="config_row">
		<div class="left">Database host
			<span class="form_required">*</span>
		</div>
		<div class="right">
			<input class="text" type="text" value="${dbHost}" value="localhost" name="db_host" type="db_host" />
		</div>
		<div class="description">
			If your database is located on a different server, change this.
		</div>
	</div>
	
	<div class="config_row">
		<div class="left">Database port</div>
		<div class="right">
			<input class="text" type="text" value="${dbPort}" name="db_port" type="db_port" />
		</div>
		<div class="description">
			If your database server is listening to a non-standard port, enter its number.
		</div>
	</div>
	
	<div class="button_holder">
		<a onclick="form.submit();" class="button">Continue</a>
	</div>
	
	<input type="hidden" name="submitted" value="1" />
</form>

<script type="text/javascript">
	$(document).ready(function() {
		$('#DB0').attr('checked', '1');
	});
</script>